Conversation
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the Cashfree Payment Gateway SDK from Pydantic v1 to Pydantic v2, updating the version to "5.0.1-beta-1". The changes include updating the Pydantic dependency constraint and migrating all model classes to use Pydantic v2's syntax.
Changes:
- Updated Pydantic dependency from
>= 1.10.24, < 2to>= 2.11.7 - Migrated all Pydantic model classes from v1
Configclass to v2model_configdictionary - Replaced
@validatordecorators with@field_validatordecorators - Updated SDK version to "5.0.1-beta-1" in setup.py, pyproject.toml, and configuration.py
Reviewed changes
Copilot reviewed 267 out of 268 changed files in this pull request and generated 228 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated version to 5.0.1-beta-1 and Pydantic dependency to >= 2.11.7 |
| pyproject.toml | Updated version to 5.0.1-beta-1 |
| configuration.py | Updated SDK package version string to 4.5.1 |
| cashfree_pg/models/*.py | Migrated 200+ model files from Pydantic v1 to v2 syntax |
| cashfree_pg/api_response.py | Added compatibility comment for Pydantic v2 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @field_validator('channel') | ||
| def channel_validate_enum(cls, value): |
There was a problem hiding this comment.
The @field_validator decorator in Pydantic v2 requires a mode parameter when used without @classmethod. In Pydantic v2, validators should use @field_validator('field_name', mode='before') or @field_validator('field_name', mode='after'). The current usage may not work correctly. This applies to all field validators in the codebase.
| "Python Version: {pyversion}\n"\ | ||
| "Version of the API: 2023-08-01\n"\ | ||
| "SDK Package Version: 4.3.10".\ | ||
| "SDK Package Version: 4.5.1".\ |
There was a problem hiding this comment.
The SDK Package Version in the debug report string is hardcoded to "4.5.1" but the actual package version has been updated to "5.0.1-beta-1" in setup.py and pyproject.toml. This creates an inconsistency that will confuse users when debugging. Update this to match the new version.
| from pydantic import Field | ||
|
|
||
| # Updated imports for Pydantic v2 compatibility |
There was a problem hiding this comment.
The Field import is added but not used in this enum class. This import should be removed to avoid unused imports.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, Field, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from pydantic import field_validator |
| from pydantic import field_validator | ||
|
|
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from pydantic import field_validator |
| from typing import List, Optional | ||
| from pydantic import BaseModel, conlist | ||
| from cashfree_pg.models.vendor_entity_related_docs_inner import VendorEntityRelatedDocsInner | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from cashfree_pg.models.bank_details import BankDetails | ||
| from cashfree_pg.models.schedule_option import ScheduleOption | ||
| from cashfree_pg.models.vendor_entity_related_docs_inner import VendorEntityRelatedDocsInner | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Any, Dict, Optional, Union | ||
| from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
Raising PR to github